package com.mercury.api;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.mercury.entity.TrtplPoMain;
import com.mercury.mapper.so.TrtplPoMainSO;
import com.mercury.service.TrtplPoMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/order")
public class TrtplPoMainController {

    @Autowired
    private TrtplPoMainService trtplPoMainService;

    @GetMapping("/orders")
    public List<TrtplPoMain> getOrders(){
        PageHelper.startPage(1, 5);
        TrtplPoMainSO so = new TrtplPoMainSO();

        so.setTenantGuid("20170916142016880001");

        List<TrtplPoMain> result = this.trtplPoMainService.searchTrtplPoMains(so);

        System.out.println(((Page<TrtplPoMain>)result).getTotal());

        return result;
    }
}
